#include <iostream>
#include <vector>
#include <string>
#include <set>
using namespace std;

int countDistinctWord(string str) {
	//在此处添加相应代码
	int len=0;
	len = str.size();
	int sum = 0;
	int l = 0;
	int bj= 0;
	string cc = "";
	for (int i = 0; i <= len; i++)
	{
		if ((str[i] == ' ')|(i == len))
		{
			for (int j = l; j < i; j++)
				cc = cc + str[j];
			bj = str.find(cc , 0);
			if (bj == l) sum++;
			l = i + 1;
			cc = "";
		}
	}
	return sum;
}

int main() {
	string str = "hello hello wwor world! Ni";
	cout << countDistinctWord(str) << endl;

	return 0;
}